using UnityEngine;

public class PlayerState_破棍式 : PlayerStateBase
{
	private bool _打中人;

	public PlayerState_破棍式()
	{
		_Data_Player招式_系数 = MonoSingleton<MyDataManager>.Instance._Data_玩家招式._破棍式;
	}

	public override void OnEnter()
	{
		_Mono._可以识破 = true;
		_Mono._C_攻击判断._击退力度 = 14f;
		_Mono._Rb2D.velocity = Vector2.zero;
		_Mono.F_玩家转向(Input.GetAxisRaw("Horizontal"));
		_Mono._Rb2D.AddForce(new Vector2((_Mono._朝向右边 ? 1 : (-1)) * -50, 0f), ForceMode2D.Impulse);
		_Mono._可以受击 = false;
		_Mono._Ani.Play("破棍式");
		_Timer = _Mono._Dict_AniName_time["破棍式"];
		_NextState = StateType_Player.正常移动;
		_打中人 = false;
		_Mono._C_攻击判断._击退力度 = 6f;
		F_创建攻击命中回调();
	}

	public override void F_攻击命中回调()
	{
		base.F_攻击命中回调();
		_打中人 = true;
	}

	public override void OnExit()
	{
		_Mono._可以识破 = false;
		_Mono._C_攻击判断._攻击命中回调 -= F_攻击命中回调;
		_Mono._可以受击 = true;
	}

	public override void OnUpdate()
	{
		_Timer -= Time.deltaTime;
		if (_Timer <= 0f)
		{
			if (_打中人 && _NextState == StateType_Player.斩棍式)
			{
				_Mono.ChangeToState(StateType_Player.斩棍式);
				_Mono._Curr豆子--;
			}
			else
			{
				_Mono.ChangeState(StateType_Player.正常移动);
			}
		}
		if (Input.GetKeyDown(KeyCode.K))
		{
			F_重攻击Down();
		}
	}

	public override void F_重攻击Down()
	{
		if (_Mono._Curr豆子 >= 1)
		{
			_NextState = StateType_Player.斩棍式;
		}
	}
}
